# Maintainer: Andrea Zagli <andrea.zagli.free@gmail.com>

_realname=icoutils
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.31.0
pkgrel=2
arch=('any')
pkgdesc="Create and extract MS Windows icons and cursors (mingw-w64)"
options=(strip staticlibs)
depends=("${MINGW_PACKAGE_PREFIX}-libpng")
options=('strip' 'staticlibs')
license=("GPL 2")
url="http://www.nongnu.org/icoutils/"
source=(https://savannah.nongnu.org/download/${_realname}/${_realname}-${pkgver}.tar.bz2
        001-win.patch)
sha256sums=('a895d9d74a418d65d39a667e58ae38be79c9e726711384551d36531696f3af71'
            'e5745ac16fbaeaf5e5ab3af66582982c17326d372406e7dba75b34f33b2b9c10')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}

  patch -p1 -i ${srcdir}/001-win.patch
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST}

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
}
